<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:composite="http://xmlns.jcp.org/jsf/composite">

    <h:body>
        <composite:interface>
            <composite:attribute name="bean" required="true"/>
        </composite:interface>

        <composite:implementation>
            <h:form id="interestFilterForm">
                <p:dialog id="interestFilterDialog" header="#{messages.Interest}" modal="true" position="top" closable="false" resizable="false" widgetVar="interestFilterDialog">
                    <p:panel id="interestFilterPanel" styleClass="noBorder noPadding noMargin">
                        <p:selectOneButton value="#{cc.attrs.bean.interestAreaOrCollector.importance}" styleClass="width100 marginBottom05em">  
                            <f:selectItem itemLabel="#{messages.Obligatory}" itemValue="#{cc.attrs.bean.obligatory}" />  
                            <f:selectItem itemLabel="#{messages.Important}" itemValue="#{cc.attrs.bean.important}" />  
                            <f:selectItem itemLabel="#{messages.Normal}" itemValue="#{cc.attrs.bean.normal}" />  
                        </p:selectOneButton>
                        <p:selectOneMenu filter="true" filterMatchMode="contains" required="false" requiredMessage="#{messages.SectorRequired}" converter="#{sectorConverter}" id="selectInterestOrSector" value="#{cc.attrs.bean.interestAreaOrCollector.sector}" effect="fade" label="#{messages.Sector}">  
                            <f:selectItem itemLabel="#{messages.Sector}" itemValue="" />  
                            <f:selectItems value="#{userResourcesBean.sectors}" var="interestOrSector" itemLabel="#{sectorBundle[interestOrSector.idSector.toString()]}" itemValue="#{interestOrSector}"/>  
                            <p:ajax event="change" update="butonAddInterestOr"/>
                        </p:selectOneMenu>

                        <p:selectOneMenu required="false" requiredMessage="#{messages.JobPositionRequired}" converter="#{jobPositionConverter}" id="selectInterestOrJobPosition" value="#{cc.attrs.bean.interestAreaOrCollector.jobPosition}" effect="fade" label="#{messages.JobPosition}">  
                            <f:selectItem itemLabel="#{messages.JobPosition}" itemValue="" />  
                            <f:selectItems value="#{userResourcesBean.jobPositions}" var="interestOrJobPosition" itemLabel="#{jobPositionBundle[interestOrJobPosition.idJobPosition.toString()]}" itemValue="#{interestOrJobPosition}"/>  
                            <p:ajax event="change" update="butonAddInterestOr"/>
                        </p:selectOneMenu>

                        <p:selectOneMenu required="false" converter="#{desiredSalaryConverter}" id="selectInterestOrMaximumDesiredSalary" value="#{cc.attrs.bean.interestAreaOrCollector.maximumDesiredSalary}" effect="fade" label="#{messages.MaximumSalary}">  
                            <f:selectItem itemLabel="#{messages.MaximumSalary}" itemValue="" />  
                            <f:selectItems value="#{userResourcesBean.desiredSalaries}" var="interestOrMaximumDesiredSalary" itemLabel="#{interestOrMaximumDesiredSalary.description}" itemValue="#{interestOrMaximumDesiredSalary}"/>  
                            <p:ajax event="change" update="butonAddInterestOr"/>
                        </p:selectOneMenu>
                        <p:commandButton process="@parent" disabled="#{cc.attrs.bean.interestAreaOrCollector.sector==null and cc.attrs.bean.interestAreaOrCollector.jobPosition==null and cc.attrs.bean.interestAreaOrCollector.maximumDesiredSalary==null}" styleClass="blueBackgroundStrong" id="butonAddInterestOr" value="#{messages.Add}" actionListener="#{cc.attrs.bean.addSearchInterestAreaRequeriment()}" oncomplete="if (args &amp;&amp; !args.validationFailed){PF('interestFilterDialog').hide();reinitWaypoint();}" update=":createSearchForm:searchPanel :facesPanel :totalFacesForm"/>
                        <p:commandButton value="#{messages.Cancel}" process="@this" styleClass="grayBackgroundStrong" style="margin-left: 3%;" actionListener="#{cc.attrs.bean.reinitSearchRelocatingRequeriment()}" update=":createSearchForm:searchPanel :createSearchForm:addFilterPanel" oncomplete="PF('interestFilterDialog').hide();"/>
                    </p:panel>
                </p:dialog>
            </h:form>
        </composite:implementation>
    </h:body>
</html>